﻿@page
@model TwoFactorAuthenticationModel
@{
    ViewData["Title"] = "双因素身份验证(2 fa)";
    ViewData["ActivePage"] = ManageNavPages.TwoFactorAuthentication;
}

<partial name="_StatusMessage" for="StatusMessage" />
<h4>@ViewData["Title"]</h4>
@if (Model.Is2faEnabled)
{
    if (Model.RecoveryCodesLeft == 0)
    {
        <div class="alert alert-danger">
            <strong>你没有恢复码了.</strong>
            <p>你必须 <a asp-page="./GenerateRecoveryCodes">生成一组新的恢复码</a> 才能使用恢复代码登录.</p>
        </div>
    }
    else if (Model.RecoveryCodesLeft == 1)
    {
        <div class="alert alert-danger">
            <strong>You have 1 recovery code left.</strong>
            <p>You can <a asp-page="./GenerateRecoveryCodes">generate a new set of recovery codes</a>.</p>
        </div>
    }
    else if (Model.RecoveryCodesLeft <= 3)
    {
        <div class="alert alert-warning">
            <strong>You have @Model.RecoveryCodesLeft recovery codes left.</strong>
            <p>You should <a asp-page="./GenerateRecoveryCodes">generate a new set of recovery codes</a>.</p>
        </div>
    }

    if (Model.IsMachineRemembered)
    {
        <form method="post" style="display: inline-block">
            <button type="submit" class="btn btn-primary">忘记这个浏览器</button>
        </form>
    }
    <a asp-page="./Disable2fa" class="btn btn-primary">禁用 2FA</a>
    <a asp-page="./GenerateRecoveryCodes" class="btn btn-primary">重置恢复代码</a>
}

<h5>身份验证应用程序</h5>
@if (!Model.HasAuthenticator)
{
    <a id="enable-authenticator" asp-page="./EnableAuthenticator" class="btn btn-line-success">添加身份验证应用程序</a>
}
else
{
<a id="enable-authenticator" asp-page="./EnableAuthenticator" class="btn btn-primary text-white">设置身份验证应用程序</a>
<a id="reset-authenticator" asp-page="./ResetAuthenticator" class="btn btn-primary text-white">重置身份验证应用程序</a>
}

@section Scripts {
    <partial name="_ValidationScriptsPartial" />
}